package cn.com.huzo.repository.trade.impl;

import cn.com.huzo.model.entities.trade.CommercialInvoiceLinesEntity;
import huzofw.repository.impl.GenericRepositoryImpl;
import huzofw.repository.impl.MyBatisDaoUtils;
import cn.com.huzo.repository.trade.CommercialInvoiceLinesRepository;
import java.util.List;
import java.util.Map;
import org.springframework.stereotype.Repository;

/**
 * 销售发票明细数据访问对象。
 *
 * @author 范学春
 */
@Repository("CommercialInvoiceLinesRepository")
public class CommercialInvoiceLinesRepositoryImpl extends GenericRepositoryImpl<CommercialInvoiceLinesEntity, String>
        implements CommercialInvoiceLinesRepository {

    private final String namespace = "cn.com.huzo.repository.trade.CommercialInvoiceLinesRepository";

    /**
     * 构造函数,设置the instance to ProductRepositoryImpl.class.
     */
    public CommercialInvoiceLinesRepositoryImpl() {
        super(CommercialInvoiceLinesEntity.class);
    }

    /**
     * {@inheritDoc}
     */
    @Override
    public List<CommercialInvoiceLinesEntity> fetchByHeaderKey(Long headerId) {
        return getSqlSession().selectList(MyBatisDaoUtils.getMapperQueryId(
                namespace, "fetchByHeaderKey"), headerId);
    }

    /**
     * {@inheritDoc}
     */
    @Override
    public List<CommercialInvoiceLinesEntity> fetchByWizardResult(Map<String, Object> criterion) {
        return getSqlSession().selectList(MyBatisDaoUtils.getMapperQueryId(
                namespace, "fetchByWizardResult"), criterion);
    }

    /**
     * {@inheritDoc}
     */
    @Override
    public Integer batchUpdate(List<CommercialInvoiceLinesEntity> itemList) {
        return getSqlSession().update(MyBatisDaoUtils.getMapperQueryId(
                namespace, "batchUpdate"), itemList);
    }

    /**
     * {@inheritDoc}
     */
    @Override
    public Integer insert(Map<String, Object> criterion) {
        return getSqlSession().insert(MyBatisDaoUtils.getMapperQueryId(namespace,
                "insert"), criterion);
    }

    /**
     * {@inheritDoc}
     */
    @Override
    public Integer batchDelete(List<CommercialInvoiceLinesEntity> itemList) {
        return getSqlSession().delete(MyBatisDaoUtils.getMapperQueryId(
                namespace, "batchDelete"), itemList);
    }

    /**
     * {@inheritDoc}
     */
    @Override
    public Integer delete(String key) {
        return getSqlSession().delete(MyBatisDaoUtils.getMapperQueryId(
                namespace, "delete"), key);
    }
}
